//
//  WYCBillController.m
//  51还款
//
//  Created by 中企互联 on 2017/10/30.
//  Copyright © 2017年 中企互联. All rights reserved.
//首页

#import "WYCBillController.h"
#import "PictureRotate.h"
#import "CCPScrollView.h"
#import "CCZTrotingLabel.h"
#import "WYCMymessegeController.h"
#import "LBBanner.h"
#import "WYCPictureModel.h"
#import "WYCBillModel.h"
#import "WYCHomeCell.h"
#import "WYCBillFrameModel.h"
#import "WYCSeeBillController.h"
#import "WYCHandBillController.h"
#import "WYCUserMessegeModel.h"
#import "WYCMailViewController.h"
#import "WYCAddCreditController.h"
#import "WYCLoginController.h"
#import "WYCmypolicyViewController.h"
#import "FGGAutoScrollView.h"
#import "WYCmyCardCotroller.h"
#import "WYCHeartViewController.h"
#import "WYCRepaymentController.h"

@interface WYCBillController ()<LBBannerDelegate,UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)FGGAutoScrollView *bannerView;

@property (nonatomic, strong) CCZTrotingLabel *trotView;
//滚动图片数组
@property(nonatomic,strong)NSMutableArray * imageArray;
//滚动图点击链接
@property(nonatomic,strong)NSMutableArray * bannerurlArray;

/** 列表*/
@property(nonatomic,strong)UITableView * tableView;

/** 数组*/
@property(nonatomic,strong)NSMutableArray * billarray;

/** 数组*/
@property(nonatomic,strong)NSMutableArray * userArray;

/** 图片*/
@property(nonatomic,strong)UIImageView * backimg;

/** 提示*/
@property(nonatomic,strong)UILabel * backLabel;

/** 按钮*/
@property(nonatomic,strong)UIButton * ImportButton;

/** view*/
@property(nonatomic,strong)UIView * billView;

/** 背景*/
@property(nonatomic,strong)UIButton * zView;


/** view*/
@property(nonatomic,strong)UIView * ejectView;
@property(nonatomic,strong)NSString * banberNm;
@property(nonatomic,strong) NSArray  *imageArr;
@property(nonatomic,strong) NSArray  *titleArr;
@property(nonatomic,assign)    NSInteger number ;

@property(nonatomic,strong)NSString * numbank;
@property(nonatomic,strong)NSString * dayLb;



@end

@implementation WYCBillController
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadversion];
   _imageArr = @[@"bank_01",@"bank_02",@"bank_03",@"bank_04"];
   _titleArr  = @[@"添加账单",@"我的卡包",@"极速办卡",@"随心借贷"];
    self.view.backgroundColor = WYCGlobalBg;
    //图片数组
     self.imageArray = [[NSMutableArray alloc] init];
    //列表数组
    self.billarray = [[NSMutableArray alloc] init];
    self.userArray = [[NSMutableArray alloc] init];
    self.bannerurlArray = [[NSMutableArray alloc]init];
    
    
    //导航
    [self setupNav];
    
    //请求banner图
    [self setBannerLoad];
    [self setusermyMessage];
    [self setupCreditcardlist];
    self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(setupCreditcardlist)];

   
}

//创建自动循环滚动视图
-(void)createUI
{
    //初始化自动循环滚动视图，并且定义图片的点击事件
    _bannerView=[[FGGAutoScrollView alloc]initWithFrame:CGRectMake(0, 64, ScreenWidth, 550*px) placeHolderImage:nil imageURLs:nil imageDidSelectedBlock:^(NSInteger selectedIndex) {
        
    }];
    if (ScreenHeight == 812) {
        _bannerView.frame = CGRectMake(0, 64, ScreenWidth, 280);
    }
    //还可以设置自动滚动时的回调事件（可不设置）
    _bannerView.imageDidScrolledBlock=^(NSInteger index){
    };
    [self.view addSubview:_bannerView];
    //创建列表
    [self setupTableView];
}
//下载数据
-(void)downloadDataWithCompletionHandle:(void(^)(NSArray *imgsArray))completion
{
   NSArray *array = _imageArray;

    //完成后调用完成的回调代码块
    if(completion)
        completion(array);
}
- (void)setusermyMessage{
    NSString * str = [NSString stringWithFormat:@"%@token=%@",usermyMessage,[WYCAccountTool unarchivetoken]];
    [HttpTool POST:str params:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        if ([[responseObject objectForKey:@"code"]intValue] == 0) {
            NSArray * resultArray = responseObject[@"result"];
            for (NSDictionary * dict in resultArray) {
                WYCUserMessegeModel * usermodel = [WYCUserMessegeModel mj_objectWithKeyValues:dict];
                [self.userArray addObject:usermodel.content];
            }
            [self showloyout];
        }else{
            [SVProgressHUD showImage:[UIImage imageNamed:@""] status:msgStr];
            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
            [SVProgressHUD setForegroundColor:[UIColor whiteColor]]; //字体颜色
            [SVProgressHUD setBackgroundColor:[UIColor blackColor]];   //背景颜色
            WYCLoginController * login = [[WYCLoginController alloc] init];
            [self presentViewController:login animated:NO completion:nil];
        }
    } fail:^(NSURLSessionDataTask *task, NSError *error) {
        
    }];
    
}

- (void)showloyout{
    
   // 通知的View
    UIView * showView = [[UIView alloc] init];
    showView.backgroundColor = [UIColor whiteColor];
    showView.frame = CGRectMake(0, 550  * px + 64, ScreenWidth, 40);
    [self.view addSubview:showView];
    
  

    
    //通知imageView
    UIImageView *noticeimageView = [[UIImageView alloc] init];
    noticeimageView.frame = CGRectMake(40 * px, 60 * px, 40 * px, 40 * px);
    noticeimageView.image = [UIImage imageNamed:@"提醒"];
    [showView addSubview:noticeimageView];
    UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(noticeimageView.frame.size.width+noticeimageView.frame.origin.x+10,40 * px, 1, 20)];
    lineView.backgroundColor = WYCbigGrayColor;
    [showView addSubview:lineView];
    
    CCZTrotingLabel *label = [[CCZTrotingLabel alloc] init];
    label.backgroundColor = [UIColor whiteColor];
    label.frame = CGRectMake(CGRectGetMaxX(noticeimageView.frame) + 60 * px, 40 * px, ScreenWidth - noticeimageView.width - 120 * px, 60 * px);
    label.direction = CCZTrotDirectionTop;
    
    self.trotView = label;
    label.repeatTextArr = YES;
    label.hideWhenStopTroting = YES;
    label.pause = 4;
    label.backgroundImage = [UIImage imageNamed:@"1"];
    [label addTextArray:self.userArray];
    [showView addSubview:label];
    
     UITapGestureRecognizer *singleTap =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(photoClick)];
    [label addGestureRecognizer:singleTap];
    
}

-(void)setBannerLoad{
    NSString * str = [NSString stringWithFormat:@"%@",bannerlist];
    
    [HttpTool POST:str params:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"首页返回%@",responseObject);
        if ([[responseObject objectForKey:@"code"]intValue] == 0) {
            NSArray * resultArray = responseObject[@"result"];
            for (NSDictionary * dict in resultArray) {

                NSString  *bannerUrl = [dict objectForKey:@"bannerUrl"];
                [_bannerurlArray addObject:bannerUrl];
                NSString  *bannerName = [dict objectForKey:@"bannerName"];
                self.banberNm = bannerName;
                [_imageArray addObject: [dict objectForKey:@"imgUrl"]];
            }
            __weak typeof(self) wkSelf=self;

            //调下载完数据后再调用setter方法刷新视图
            [self downloadDataWithCompletionHandle:^(NSArray *imgsArray){
                wkSelf.bannerView.imageURLArray=imgsArray;
            }];
            
        }else{
            [SVProgressHUD showImage:[UIImage imageNamed:@""] status:msgStr];
        }
    } fail:^(NSURLSessionDataTask *task, NSError *error) {
        
    }];

}

#pragma mark ------>>创建tableview
- (void)setupTableView{
    //功能栏View
    UIView * showView = [[UIView alloc] init];
    showView.backgroundColor = [UIColor whiteColor];
    showView.frame = CGRectMake(0, _bannerView.frame.size.height+_bannerView.frame.origin.y+50, ScreenWidth, 80);
    [self.view addSubview:showView];
   
    for (int i = 0; i<_imageArr.count; i++)
    {
        
        UIButton  *btnank = [UIButton buttonWithType:UIButtonTypeCustom];
        btnank.frame = CGRectMake(ScreenWidth/_number*i, 0, ScreenWidth/_number, 100);
        btnank.tag = 300+i;
       [ btnank addTarget:self action:@selector(pressMain:) forControlEvents:UIControlEventTouchUpInside];
        
        [showView addSubview:btnank];
        
        //通知imageView
        UIImageView *noticeimageView = [[UIImageView alloc] init];
        noticeimageView.frame = CGRectMake((ScreenWidth/_number-44)/2, 10, 44, 44 );
        noticeimageView.image = [UIImage imageNamed:[_imageArr objectAtIndex:i]];
        [btnank addSubview:noticeimageView];
        UILabel  *banLb = [[UILabel alloc]init];
        banLb.frame = CGRectMake(0, 60, ScreenWidth/_number, 20);
        banLb.textAlignment  = NSTextAlignmentCenter;
        banLb.textColor = [UIColor blackColor];
        banLb.text = [_titleArr objectAtIndex:i];
        banLb.font = [UIFont systemFontOfSize:13];
        [btnank addSubview:banLb];
    }
    UIView  *footview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 40)];
    footview.backgroundColor = [UIColor whiteColor];
    footview.userInteractionEnabled = YES;
    int a = 1200 * px;
    int b = NavHeight;
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,_bannerView.frame.size.height+_bannerView.frame.origin.y+140, ScreenWidth, ScreenHeight-(a+b)) style:UITableViewStylePlain];
    self.tableView.backgroundColor = WYCgrayColor;
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
    self.tableView.tableFooterView = footview;
    [self.view addSubview:self.tableView];
    UIButton * cellbutton = [[UIButton alloc] init];
    cellbutton.frame = CGRectMake(0, 0, ScreenWidth, 40);
    cellbutton.titleLabel.font = [UIFont systemFontOfSize:WyzFont];
    [cellbutton setTitleColor:wycMain forState:UIControlStateNormal];
    cellbutton.contentHorizontalAlignment = UIControlContentVerticalAlignmentCenter;
    [cellbutton addTarget:self action:@selector(addbankButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [cellbutton setTitle:@"+添加信用卡" forState:UIControlStateNormal];
    cellbutton.backgroundColor = [UIColor whiteColor];
    [footview addSubview:cellbutton];
}
-(void)pressMain:(UIButton *)sender
{
    
    if(sender.tag == 300)
    {
        NSLog(@"添加账单");
        [self    addClick];
    }
    else if (sender.tag == 301)
    {
        NSLog(@"我的卡包");
    WYCRepaymentController *dynamicVC = [[WYCRepaymentController alloc] init];
        [self.navigationController pushViewController:dynamicVC animated:YES];

    }
    else if (sender.tag == 302)
    {
        NSLog(@"急速办卡");
        WYCmyCardCotroller *bankView = [[WYCmyCardCotroller alloc]init];
        [self.navigationController pushViewController:bankView animated:YES];

    }
    else if (sender.tag == 303)
    {
        NSLog(@"随心借贷");
        WYCHeartViewController *hertView = [[WYCHeartViewController alloc]init];
        [self.navigationController pushViewController:hertView animated:YES];

    }
}
-(void)addbankButtonClick
{
    NSLog(@"添加信用卡");
    WYCAddCreditController  *addBank = [[WYCAddCreditController alloc]init];
    [self.navigationController pushViewController:addBank animated:YES];
}
#pragma make ------->>>列表请求
- (void)setupCreditcardlist{
    
    [self.billarray removeAllObjects];
    NSString *cardlist = [NSString stringWithFormat:@"%@token=%@",creditcardlist,[WYCAccountTool unarchivetoken]];
    [HttpTool POST:cardlist params:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        if ([[responseObject objectForKey:@"code"] intValue ] == 0) {
            NSArray * resultArray = responseObject[@"result"];
            for (NSDictionary * dict in resultArray) {
                
                WYCBillModel * model = [WYCBillModel mj_objectWithKeyValues:dict];
                if ([model.isHideCard isEqualToString:@"1"]) {
                    continue;
                }else{
                WYCBillFrameModel * BillFrameModel = [[WYCBillFrameModel alloc] init];
                BillFrameModel.Billmodel = model;
                
                [self.billarray addObject:BillFrameModel];
                    
                    if (self.billarray.count == 0) {
                        self.tableView.hidden = YES;
                        [self ObtainButton];
                    }else{
                        self.tableView.hidden = NO;
                        [self.billView setHidden:YES];
                    }
                }
            }
        }else{
            
            [SVProgressHUD showImage:[UIImage imageNamed:@""] status:msgStr];
            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
            [SVProgressHUD setForegroundColor:[UIColor whiteColor]]; //字体颜色
            [SVProgressHUD setBackgroundColor:[UIColor blackColor]];   //背景颜色
        }
        
        [self.tableView reloadData];
        [self.tableView.mj_header endRefreshing];
    } fail:^(NSURLSessionDataTask *task, NSError *error) {
        
        [SVProgressHUD showImage:[UIImage imageNamed:@""] status:Failed];
        [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
        [SVProgressHUD setForegroundColor:[UIColor whiteColor]]; //字体颜色
        [SVProgressHUD setBackgroundColor:[UIColor blackColor]];   //背景颜色
    }];
    
}
- (void)ObtainButton{
    
    self.billView = [[UIView alloc] init];
    self.billView.frame = CGRectMake(ScreenWidth / 3 , 1000 * px, ScreenWidth / 3 + 100 * px, ScreenWidth / 3);
    self.billView.backgroundColor = WYCGlobalBg;
    [self.view addSubview:self.billView];
    
    _backimg = [[UIImageView alloc] init];
    _backimg.image = [UIImage imageNamed:@"home_bakcimg"];
    _backimg.frame = CGRectMake(0, 0, self.billView.width, self.billView.height - 238 * px);
    [self.billView addSubview:_backimg];
    
    
    _backLabel = [[UILabel alloc] init];
    _backLabel.text = @"还没有账单信息哟~";
    _backLabel.textAlignment = NSTextAlignmentCenter;
    _backLabel.font = [UIFont systemFontOfSize:SmallFont];
    _backLabel.textColor = WYCRGBColor(186, 186, 186);
    _backLabel.frame = CGRectMake(_backimg.x,CGRectGetMaxY(_backimg.frame) + 10 * px,_backimg.width,48 * px);
    [self.billView addSubview:_backLabel];
    
    
    _ImportButton = [[UIButton alloc] init];
    _ImportButton.frame = CGRectMake(_backLabel.x + 50 * px, CGRectGetMaxY(_backLabel.frame) + 80 * px, _backLabel.width - 100 * px , 100 * px);
    [_ImportButton setTitle:@"导入账单" forState:UIControlStateNormal];
    [_ImportButton addTarget:self action:@selector(importClick) forControlEvents:UIControlEventTouchUpInside];
    _ImportButton.backgroundColor = [UIColor whiteColor];
    _ImportButton.titleLabel.font = [UIFont systemFontOfSize:MiddleFont];
    [_ImportButton setTitleColor:WYCRGBColor(195, 195, 195) forState:UIControlStateNormal];
    [self.billView addSubview:_ImportButton];
}


-(void)alterUrl
{
    //我的保单
    WYCmypolicyViewController * aboutMe = [[WYCmypolicyViewController alloc] init];
    [self.navigationController pushViewController:aboutMe animated:NO];
}
#pragma make ------>>界面布局
- (void)setupNav{
    
    //添加轮播图
    self.navigationItem.title = @"58卡秘书";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    [self.navigationController.navigationBar setBarTintColor:wycMain];
    
    //左侧按钮
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"ring" hight:@"ring" target:self action:@selector(photoClick)];
    
    //右侧按钮
//    self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithImage:@"add" hight:@"add" target:self action:@selector(addClick)];
   
    
}
#pragma make--------->>导入账单
- (void)showClick{
    WYCLogFunc;
    
}
#pragma make ------>>右侧按钮 点击事件
- (void)addClick{
    
    WYCLogFunc;
    
    
    UIView * ejectView = [[UIView alloc] init];
    ejectView.frame = CGRectMake(0, ScreenHeight - 500 * px, ScreenWidth, 500 * px);
    ejectView.backgroundColor = [UIColor whiteColor];
    [[UIApplication sharedApplication].keyWindow  addSubview:ejectView];
    self.ejectView = ejectView;
    
    
    UIButton * zView = [[UIButton alloc] init];
    zView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight - ejectView.height);
    zView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
    [zView addTarget:self action:@selector(zviewClick) forControlEvents:UIControlEventTouchUpInside];
    [[UIApplication sharedApplication].keyWindow  addSubview:zView];
    self.zView = zView;
    
//    UIButton * maillButton = [[UIButton alloc] init];
//    maillButton.frame = CGRectMake(0, 25 * px, ejectView.width, 100 * px);
//    [maillButton setTitle:@"邮箱导入" forState:UIControlStateNormal];
//    maillButton.titleLabel.font = [UIFont systemFontOfSize:MiddleFont];
//    [maillButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    maillButton.contentHorizontalAlignment =
//    UIControlContentHorizontalAlignmentCenter;
//    [maillButton addTarget:self action:@selector(maillButtonClick) forControlEvents:UIControlEventTouchUpInside];
//    [ejectView addSubview:maillButton];
    
    
    UIView * mallLine = [[UIView alloc] init];
    mallLine.backgroundColor = [UIColor grayColor];
    mallLine.frame = CGRectMake(0,  25 * px, ejectView.width, 0.5);
    [ejectView addSubview:mallLine];
    
    
    UIButton * holdButton = [[UIButton alloc] init];
    holdButton.frame = CGRectMake(0, CGRectGetMaxY(mallLine.frame) + 25 * px, ejectView.width, 100 * px);
    [holdButton setTitle:@"手输账单" forState:UIControlStateNormal];
    holdButton.titleLabel.font = [UIFont systemFontOfSize:MiddleFont];
    [holdButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    holdButton.contentHorizontalAlignment =
    UIControlContentHorizontalAlignmentCenter;
    [holdButton addTarget:self action:@selector(holdButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [ejectView addSubview:holdButton];
    
    
    UIView * line = [[UIView alloc] init];
    line.backgroundColor = WYCGlobalBg;
    line.frame = CGRectMake(0, CGRectGetMaxY(holdButton.frame) + 25 * px, ejectView.width, 20 * px);
    [ejectView addSubview:line];
    
    
    UIButton * NoButton = [[UIButton alloc] init];
    NoButton.frame = CGRectMake(0, CGRectGetMaxY(line.frame) + 25 * px, ejectView.width, 100 * px);
    [NoButton setTitle:@"取消" forState:UIControlStateNormal];
    NoButton.titleLabel.font = [UIFont systemFontOfSize:MiddleFont];
    [NoButton addTarget:self action:@selector(NoButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [NoButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    NoButton.contentHorizontalAlignment =
    UIControlContentHorizontalAlignmentCenter;
    [ejectView addSubview:NoButton];
    
}
- (void)maillButtonClick{
    self.zView.hidden = YES;
    self.ejectView.hidden = YES;
    WYCMailViewController  *mailView = [[WYCMailViewController alloc]init];
    [self.navigationController pushViewController:mailView animated:YES];
}

- (void)holdButtonClick{
    WYCLogFunc;
    self.zView.hidden = YES;
    self.ejectView.hidden = YES;
    WYCHandBillController * handbill = [[WYCHandBillController alloc] init];
    [self.navigationController pushViewController:handbill animated:NO];
}

- (void)NoButtonClick{
    WYCLogFunc;
    self.zView.hidden = YES;
    self.ejectView.hidden = YES;
    
}
- (void)zviewClick{
    WYCLogFunc;
    self.zView.hidden = YES;
    self.ejectView.hidden = YES;
}
#pragma make ------>>左侧按钮 点击事件
- (void)photoClick{
    WYCMymessegeController * mymessege = [[WYCMymessegeController alloc] init];
    [self.navigationController pushViewController:mymessege animated:NO];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (self.billarray.count>0) {
        return self.billarray.count;
    }
    else
    return 1;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 160;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   
    static NSString * strID = @"cell";
    
    WYCHomeCell * cell = [tableView dequeueReusableCellWithIdentifier:strID];
    
    if (cell == nil)
    {
        
        cell=[[[NSBundle mainBundle]loadNibNamed:@"WYCHomeCell" owner:self options:nil]lastObject];
        
    }
    if (self.billarray.count>0) {
        cell.billmodelFrame = self.billarray[indexPath.row];

    }else
    {
    cell.userInteractionEnabled = NO;
    }
    
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    cell.backgroundColor = [UIColor clearColor];
    if ([cell.repaymentButton.titleLabel.text isEqualToString:@"立即认证"]) {
        [cell.repaymentButton addTarget:self action:@selector(repayMentClick) forControlEvents:UIControlEventTouchUpInside];
    }
    else
    {
       [cell.repaymentButton addTarget:self action:@selector(bankBtn) forControlEvents:UIControlEventTouchUpInside];
    }
    self.numbank =cell.moneyPlanlb.text;
    self.dayLb = cell.moneyLb.text;
    return cell;
}
-(void)bankBtn
{
    [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"绑定成功！请耐心等待认证结果"];
    
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]]; //字体颜色
    [SVProgressHUD setBackgroundColor:[UIColor blackColor]];   //背景颜色
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    WYCBillFrameModel * frameModel = self.billarray[indexPath.row];
    
    if ([frameModel.Billmodel.approve isEqualToString:@"2"]) {
        
        return;
    }else{
        
        WYCSeeBillController * SeeBill = [[WYCSeeBillController alloc] init];
        //银行卡账号
        SeeBill.cardId = frameModel.Billmodel.cardId;
        //银行卡姓名
       SeeBill.bankName = frameModel.Billmodel.bankName;
        //银行卡后四位
        SeeBill.lastNumber = frameModel.Billmodel.lastNumber;
        //银行卡多少天出账单
        SeeBill.outbBllDay = frameModel.Billmodel.outbBllDay;
        //本期账单金额
        SeeBill.billAmount = frameModel.Billmodel.billAmount;

        //免息期
        SeeBill.gracePeriod = frameModel.Billmodel.gracePeriod;
        //总额度
        SeeBill.creditLine = frameModel.Billmodel.creditLine;
        //还款日
        SeeBill.dueDate = frameModel.Billmodel.dueDate;
        //账单日
      SeeBill.billDate = frameModel.Billmodel.billDate;
        SeeBill.userCard = frameModel.Billmodel.userCard;
        SeeBill.bankType = frameModel.Billmodel.state;
        SeeBill.bankid = frameModel.Billmodel.bankId;
        SeeBill.strBank = self.numbank;
        SeeBill.strDay =self.dayLb;
//
        [self.navigationController pushViewController:SeeBill animated:NO];
    }
}
//导入账单
- (void)importClick{
    
    [self addClick];
}
- (void)repayMentClick{
    
    WYCAddCreditController  *addBank = [[WYCAddCreditController alloc]init];
    [self.navigationController pushViewController:addBank animated:YES];
   
}

-(void)loadversion
{
    
    NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
    
    NSMutableDictionary * params = [NSMutableDictionary dictionary];
    NSString *appVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];
    NSLog(@"=======%@",appVersion);
    params[@"version"] = appVersion;
    
    [HttpTool POST:function params:params success:^(NSURLSessionDataTask *task, id responseObject) {
        if ([[responseObject objectForKey:@"code"] intValue ] == 0) {
            NSLog(@"第一%@",responseObject);
//            if ([[responseObject objectForKey:@"result"] intValue ] == 0) {
//                _number = 2;
//            }
//            else
//            {
                _number = 4;
          //  }
            
        }
        
        [self createUI];

    } fail:^(NSURLSessionDataTask *task, NSError *error) {
        
        [self showToast:Failed];
    }];
}
@end
